﻿using System;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using Red.Controls.Shell;
using Red.Core.Extensions;

namespace EngineDebugEditor
{
    [Export( typeof( IEditorInfo ) )]
    public class EditorInfo : IEditorInfo
    {
        public string Name
        {
            get { return "Engine debug window"; }
        }

        public Type WindowClass
        {
            get { return typeof( EngineDebugEditor ); }
        }

        public Type SettingsClass
        {
            get { return typeof( EngineDebugEditorSettings ); }
        }
    }
    
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class EngineDebugEditor : RedEditorWindow
    {
        public EngineDebugEditor( IEditorHost host, EditorInstanceData instanceData, EditorSharedData sharedData )
            : base( host, instanceData, sharedData )
        {
            SetDataContext().DoNotAwait();
            InitializeComponent();
        }

        private async Task SetDataContext()
        {
            DataContext = await SharedData.EngineObjectRoot;
        }
    }
}
